﻿namespace TfsCloudDeploy.Workflow.Core.Activities
{
    using System;
    using System.Reflection;
    using System.ComponentModel;

    /// <summary>
    /// Reflected from Microsoft.TeamFoundation.Build.Workflow.Activities.SRDescriptionAttribute.
    /// Assembly: Microsoft.TeamFoundation.Build.Workflow, Version=10.0.0.0.
    /// </summary>
    [AttributeUsage(AttributeTargets.All)]
    internal sealed class SRDescriptionAttribute : DescriptionAttribute
    {
        // Fields
        private const BindingFlags GetBindingFlags = (BindingFlags.Public | BindingFlags.Static);

        // Methods
        [Obsolete("Change to explicitly call ctor(Type, String)")]
        public SRDescriptionAttribute(string description)
            : this(typeof(WorkflowResources), description)
        {
        }

        public SRDescriptionAttribute(Type type, string description)
            : base((string)type.GetMethod("Get", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { description }))
        {
        }
    }
}
